import request from '@/utils/request'

const dept = {
  /**
   * 查询部门下拉树结构
   * @param query
   */
  treeSelect(query) {
    return request({
      url: 'admin/sys-dept/tree',
      method: 'get',
      params: query

    })
  },
  /**
   * 分页
   * @param query
   */
  listDept(query) {
    return request({
      url: 'admin/sys-dept/list/',
      method: 'get',
      params: query

    })
  },

  getDept(id) {
    return request({
      url: 'admin/sys-dept/get/'+id,
      method: 'get'

    })
  },
  delDept(ids) {
    return request({
      url: 'admin/sys-dept/remove/'+ids,
      method: 'delete'

    })
  },
  addDept(data) {
    return request({
      url: 'admin/sys-dept/create',
      method: 'post',
      data: data

    })
  },
  updateDept(data) {
    return request({
      url: 'admin/sys-dept/update',
      method: 'put',
      data: data

    })
  },
  /**
   * 查询部门列表（排除节点）
   * @param data
   */
  listDeptExcludeChild(deptId) {
    return request({
      url: 'admin/sys-dept/list/exclude/' + deptId,
      method: 'get'

    })
  },
  roleDeptTree(roleId) {
    return request({
      url: 'admin/sys-dept/roleDeptTree/' + roleId,
      method: 'get'

    })
  },

}

export default dept
